package bat.iog.FTP.sever.demo1;

import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;

import java.io.IOException;

public class FTPServer {
    private FTPClient ftpClient;

    public FTPServer() {
        this.ftpClient = new FTPClient();
    }

    public void startServer(String server, int port) {
        try {
            ftpClient.connect(server, port);
            ftpClient.login("username", "password"); // 用你的用户名和密码替换  
            ftpClient.enterLocalPassiveMode();
            ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
}
